package srcInterviewPrep;

public class LinkedListNode 
{
    public int data;
    public LinkedListNode next;
    
    public LinkedListNode(int data)
    {
        this.data = data;
    }
    
    @Override
    public String toString()
    {
        StringBuilder sb = new StringBuilder();
        
        LinkedListNode n = this;
        
        while (n != null)
        {
            sb.append(n.data);
            sb.append(" -> ");
            n = n.next;
        }
        
        return sb.toString();
    }
}
